package com.gdwhomework.chapter07;

public class HomeWork002 {
    public static void main(String[] args) {
        Teacher teacher = new Teacher("汤老师", 33, "教授", 10000);
        teacher.introduce();
        Professor professor = new Professor("王教授", 44, "教授", 13000);
        professor.introduce();
    }
}

class Teacher {
    //属性
    private String name;
    private int age;
    private String post;
    private double salary;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public Teacher(String name, int age, String post, double salary) {
        this.name = name;
        this.age = age;
        this.post = post;
        this.salary = salary;
    }

    public void introduce() {
        System.out.println(this);
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", post='" + post + '\'' +
                ", salary=" + salary +
                '}';
    }
}

class Professor extends Teacher {
    public Professor(String name, int age, String post, double salary) {
        super(name, age, post, salary);
    }

    @Override
    public void introduce() {
        super.introduce();
    }

    @Override
    public String toString() {
        return super.toString();
    }
}